package cn.com.ntr.jhclient.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import cn.com.ntr.jhclient.R;
import cn.com.ntr.jhclient.model.JobFairPosition;

public class JobFairPositionAdapter extends EnhancedAdapter<JobFairPosition> {

	public JobFairPositionAdapter(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
		
	public void addAll(List<JobFairPosition> list){
		this.dataList=list;
		notifyDataSetChanged();
	}
	@Override
	protected void bindView(View paramView, Context paramContext, int position) {
		// TODO Auto-generated method stub
		JobFairPosition job=getItem(position);
		ViewHolder holder=(ViewHolder)paramView.getTag();	
		holder.tvPosition.setText(job.getPosition());
//		holder.tvHire.setText(job.getHire());
		holder.tvFlag.setText(job.getFlag());
		holder.tvName.setText(job.getComName());
		holder.chk.setVisibility(View.GONE);
		holder.iv.setVisibility(View.VISIBLE);
	}

	@Override
	protected View newView(Context context, int i, ViewGroup viewgroup) {
		// TODO Auto-generated method stub
		View view = LayoutInflater.from(mContext).inflate(
				R.layout.job_fair_tanwei, null);
		ViewHolder holder = new ViewHolder();
		holder.tvPosition=(TextView)view.findViewById(R.id.tvCompany);
//		holder.tvHire=(TextView)view.findViewById(R.id.tvDate);
		holder.chk=(CheckBox)view.findViewById(R.id.delete);
		holder.tvFlag=(TextView)view.findViewById(R.id.tvflag);
		holder.tvName=(TextView)view.findViewById(R.id.tvName);
		holder.iv=(ImageView)view.findViewById(R.id.arrow_item_1);
		view.setTag(holder);
		return view;
	}

	private class ViewHolder {
		TextView tvPosition,tvHire,tvFlag,tvName;
		CheckBox chk;
		ImageView iv;
	}
}
